<%@ page language="java" pageEncoding="UTF-8" %>

<!DOCTYPE html>
<html>
<head>
    <base href="${base}"/>
    <meta charset="UTF-8"/>
    <title>企业会员中心 - 人才系统</title>
    <link rel="shortcut icon" href="favicon.ico"/>
    <link href="styles/user.css" rel="stylesheet" type="text/css"/>
</head>
<script src="js/jquery-2.0.3.js"></script>

<style>
    html, body, #container {
        height: 100%;
        width: 100%;
    }


</style>

<body>
<jsp:include page="../header.jsp"></jsp:include>
<!--导航 -->
<div class="floatnav">
    <jsp:include page="../nav.jsp"></jsp:include>
</div>
<!--导航end -->
<div class="page_location link_bk">

    当前位置：<a href="//">首页</a>&nbsp;>>&nbsp;<a href="index.jsp">会员中心</a>&nbsp;>>&nbsp;公司信息&nbsp;>>&nbsp;标注电子地图
</div>
<table width="985" border="0" align="center" cellpadding="0"
       cellspacing="0" style="margin-top: 8px;">
    <tr>
        <td width="200" valign="top" class="link_bk">
            <jsp:include
                    page="left.jsp"></jsp:include>
        </td>
        <td valign="top">
            <div class="user_right_box">
                <div class="user_right_top_tit_bg">
                    <h1>设置电子地图</h1>
                </div>
                <table width="100%" border="0" cellpadding="4" cellspacing="0"
                       bgcolor="#FFFFFF">
                    <tr>
                        <td height="30" bgcolor="#FFFFFF" class="link_lan"
                            style="padding-left: 20px; color: #009900;">
                            请在地图上找见您的具体位置，然后点击地图右上角“标记我的位置”，标记位置完成后点击“保存我的位置”。
                            <form action="?act=company_map_set_save" method="post"
                                  style="padding: 0px; margin: 0px;" id="form1" name="form1">
                                <input name="x" type="hidden" id="x"><input name="y"
                                                                            type="hidden" id="y"><input name="zoom"
                                                                                                        type="hidden"
                                                                                                        id="zoom">
                            </form>
                        </td>
                    </tr>
                    <tr>
                        <td height="500" valign="top" bgcolor="#FFFFFF">
							<div id="container" style="width:100%; height:100%;resize:both;"></div>
                            <script type="text/javascript">

                            </script>
                        </td>
                    </tr>
                </table>
            </div>
        </td>
    </tr>
</table>
<jsp:include page="../footer.jsp"></jsp:include>
<script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script>
<script type="text/javascript">
	var map;
	window.init = function(){
        var address = '${company.address}';



		map = new AMap.Map('container', {
			resizeEnable: true,

		});
		markLocation('container', address);

	}

	function markLocation(mapId, address) {
		AMap.plugin('AMap.Geocoder', function() {
			var geocoder = new AMap.Geocoder();
			geocoder.getLocation(address, function(status, result) {
				if (status === 'complete' && result.info === 'OK') {

					// 经纬度
					var lng = result.geocodes[0].location.lng;
					var lat = result.geocodes[0].location.lat;

					// 地图实例
					var map = new AMap.Map(mapId, {
						resizeEnable: true, // 允许缩放
						center: [lng, lat], // 设置地图的中心点
						zoom: 15 　　　　　　 // 设置地图的缩放级别，0 - 20
					});

					// 添加标记
					var marker = new AMap.Marker({
						map: map,
						position: new AMap.LngLat(lng, lat),   // 经纬度
					});
				} else {
					console.log('定位失败！');
				}
			});
		});
	}
</script>
<script src="https://webapi.amap.com/maps?v=1.4.15&key=e892751b313a4ddb749e360744c8e7dc&callback=init"></script>

</body>
</html>
